8 function isInt(d : double) : boolean;
\r
10 result := (floor(d) = d);
\r
13 procedure printFloat(d : double);
\r
15 ReplaceFlags : TReplaceFlags;
\r
17 writeln(StringReplace(format('$%f', [d]), ',', '.' ReplaceFlags));
\r
18 //writeln(StringReplace(formatFloat('$#0.00', d), ',', '.', ReplaceFlags));
\r
22 s : Array[0..1001] of double;
\r
24 promedio, mas, menos : double;
\r
26 ReplaceFlags : TReplaceFlags;
\r
29 //reset(input, 'inside.txt');
\r
30 //reset(output, 'outside.txt');
\r
40 promedio := promedio + s[i];
\r
42 promedio := promedio / n;
\r
43 if (isInt(promedio * 100)) then
\r
48 promedio := floor(promedio * 100) / 100;
\r
50 //printFloat(promedio); writeLn('(Redondeado hacia abajo)');
\r
53 if s[i] < promedio then
\r
54 menos := menos + abs(s[i] - promedio)
\r
56 if s[i] > promedio then
\r
59 mas := mas + abs(s[i] - (promedio + 0.01))
\r
61 mas := mas + abs(s[i] - promedio);
\r